package org.example.vo;

// import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;
import java.util.Map;


public class PageBean<T> {
    //dev
    private int pageSize;
    private int currentPage;
    private int pageTotal;
    private T param;
    private Map<String, String> otherParam;
    private List<T> list;

    public static <T> PageBean<T> getPage(Class<T> eClass) {
        return new PageBean<>();
    }

    public int getPageSize() {
        return pageSize;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public Map<String, String> getOtherParam() {
        return otherParam;
    }

    public List<T> getList() {
        return list;
    }

    public PageBean<T> setPageSize(int pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public PageBean<T> setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
        return this;
    }

    public PageBean<T> setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
        return this;
    }

    public PageBean<T> setOtherParam(Map<String, String> otherParam) {
        this.otherParam = otherParam;
        return this;
    }

    public PageBean<T> setParam(T param) {
        this.param = param;
        return this;
    }

    public T getParam() {
        return param;
    }

    public PageBean<T> setList(List<T> list) {
        this.list = list;
        return this;
    }

    // public static <T> PageBean<T> getPageData(Page<T> page) {
    //     return new PageBean<T>()
    //             .setCurrentPage((int) page.getCurrent())
    //             .setPageTotal((int) page.getTotal())
    //             .setList(page.getRecords());
    // }

    @Override
    public String toString() {
        return "PageBean{" +
                "pageSize=" + pageSize +
                ", currentPage=" + currentPage +
                ", pageTotal=" + pageTotal +
                ", otherParam=" + otherParam +
                ", list=" + list +
                '}';
    }
}
